package com.chinaunicom.behavior.mediator;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/8/17 9:56
 * Description: 具体中介者角色
 */
public class ConcreteMediator implements Mediator{
    @Override
    public void notify(Component Sender) {
        if (Sender instanceof ComponentA){
            reactOnA();
        }else if(Sender instanceof  ComponentB){
            reactOnB();
        }
    }
    
    public void reactOnA(){
        // 中介者调用其他对象接口
        System.out.println("react on A .......");
    }

    public void reactOnB(){
        System.out.println("react on B .......");
    }
    
}
